package com.csxy.systemmanager.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csxy.systemmanager.common.ResponseResult;
import com.csxy.systemmanager.dao.OrderDao;
import com.csxy.systemmanager.entity.Order;
import com.csxy.systemmanager.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service("OrderService")
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderDao orderDao;
//    @Override
//    public ResponseResult selectAllOrderList() {
//
//        return new ResponseResult<>(200,"ok",orderDao.selectAllOrderList());
//    }

    @Override
    public IPage<Order> getOrderListByPage(Integer current, Integer size, Order order) {
        Page<Order> page = new Page<>(current,size);
        return orderDao.queryByPage(page,order);
    }

    @Override
    public ResponseResult insertOrders(Order order) {
        return new  ResponseResult<>(200,"插入订单成功",orderDao.insertOrders(order));
    }

    @Override
    public ResponseResult updateOrdersById(Order order) {
        return new ResponseResult(200,"更新订单成功",orderDao.updateOrdersById(order));
    }

    @Override
    public ResponseResult searchOrdersByShopName(Order order) {
        return new ResponseResult<>(200,"查询订单成功",orderDao.searchOrdersByShopName(order));
    }

    @Override
    public ResponseResult deleteOrdersById(Integer orderId) {
        return new ResponseResult<>(200,"删除订单成功",orderDao.deleteById(orderId));
    }

}
